home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AOCE Sample Code / PowerTalk Access Modules / Sample PMSAM / PMSAM Framework / RoboSamSlot / ALetter.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-28  |  6.6 KB  |  267 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        ALetter.h
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Written by:    Tim Harnett
  7.  
  8.     Copyright:    © 1994 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.         <15>     2/27/95    TMH        adapt to use ETO16 universal headers
  13.         <13>     2/10/95    TMH        change wireless to HFS
  14.         <10>     1/11/95    TMH        added nested letter functions, and tweak to generalize framework
  15.          <9>    12/12/94    TMH        added constructorIOutgoingALetter(TMSAMSlot* slot, long
  16.                                     letterSeqNo)
  17.          <8>     12/2/94    TMH         added ::LetterID()
  18.          <5>    10/27/94    JHB        Add functionality for support of Tmailhandler
  19.          <4>    10/14/94    TMH         added PutRecipient(StringPtr ..) method
  20.          <3>     10/3/94    TMH        break of TWireless&TEWorld from TExternalSlot
  21.          <2>     9/30/94    TMH        stuff to write the To: recipients
  22.          <1>     9/20/94    TMH        Abandon RoadsideRest embrace Mercury
  23.                   9/1/94    TMH        xxx put comment here xxx
  24.  
  25.     To Do:
  26. */
  27.  
  28. #ifndef __ALetter__
  29. #define __ALetter__
  30.  
  31. class TIncomingXLetter;
  32. class TMSAMSlot;
  33. class CDSSpec;
  34.  
  35. #ifndef __TAOCEEnclosure__
  36. #include "AOCEEnclosure.h"
  37. #endif
  38.  
  39. #ifndef __Letter__
  40. #include "Letter.h"
  41. #endif
  42.  
  43. #ifndef __MEMORY__
  44. #include "Memory.h"
  45. #endif
  46.  
  47. #ifndef __FILES__
  48. #include "Files.h"
  49. #endif
  50.  
  51. #ifndef __STRINGS__
  52. #include "Strings.h"
  53. #endif
  54.  
  55.  
  56. //---------------------------------
  57. //    MSAM Utilities    ••• put in a object?
  58. //---------------------------------
  59.  
  60. OSErr OpenNested(MailMsgRef parentMsgRef,MailMsgRef& nestedMsgRef);
  61. MailNestingLevel GetNestingLevel(MailMsgRef nestedMsgRef);
  62. void GetSubject(MailMsgRef nestedMsgRef,CRString32& subject);
  63.  
  64.  
  65. //--------------------------------------
  66. //        T A L e t t e r
  67. //--------------------------------------
  68.  
  69. class TALetter : public TLetter {
  70. public:
  71.                         TALetter();
  72.     void                IALetter(TMSAMSlot* msamSlot);
  73.  
  74.  
  75.         //    Accessors
  76.     MailIndications        GetMailIndications() { return fIndications; }; 
  77.     MailMsgRef            MsgRef()              { return fMsgRef; }
  78.     
  79.     MailLetterID        LetterID() { return fLetterID; };
  80.     MailNestingLevel    NestingLevel() { return fNestingLevel; };
  81.     
  82.     Boolean                HasNestedLetters() { return fNestingLevel != 0; }
  83.     Boolean                IsOpen() { return fMsgRef != 0; }
  84.  
  85.     void                EnumEnclosures();
  86.     
  87.     Boolean                HasEnclosure();
  88.     
  89.     TAOCEEnclosure*        fAOCEEnclosure;
  90.  
  91.     
  92. protected:
  93.     MailMsgRef            fMsgRef;
  94.     long                fSeqNum;
  95.     
  96.     MailIndications        fIndications;
  97.  
  98.     Boolean                fHasEnclosure;
  99.  
  100.     MailNestingLevel    fNestingLevel;
  101.     MailLetterFlags        fLetterFlags;
  102.     OCECreatorType        fCreatorType;
  103.     OSType                fMsgFamily;
  104.     MailLetterID        fLetterID;
  105.     MailLetterID        fReplyID;
  106.     MailLetterID        fConversationID;
  107.     MailTime            fMailTime;
  108.  
  109.     
  110. };
  111.  
  112.  
  113. //--------------------------------------
  114. //        T I n c o m i n g A L e t t e r
  115. //--------------------------------------
  116.  
  117. //    We create this letter from an external system letter.
  118.  
  119. class TIncomingALetter : public TALetter {
  120. public:
  121.                         TIncomingALetter();
  122.                         ~TIncomingALetter();
  123.                         
  124.             void        IIncomingALetter(TMSAMSlot* slot,TIncomingXLetter* incomingXLetter);
  125.             void        IIncomingALetter(TMSAMSlot* slot, char* subject,char* fromRecipient);
  126.             void        IIncomingALetter(TMSAMSlot* slot, StringPtr subject, StringPtr fromRecipient);
  127.             void         IIncomingALetter(TMSAMSlot* slot, MailTime*    sendTime, char* subject,char* fromRecipient);
  128.             void         IIncomingALetter(TMSAMSlot* slot, MailTime*    sendTime, StringPtr subject, StringPtr fromRecipient);
  129.  
  130.     
  131.     virtual    void        SetHeaderInfo();        //    set from the incoming XLetter.
  132.     
  133.  
  134.             OSErr         CreateInTraySummary();
  135.             OSErr         CreateInTraySummary(MailTime* letterTimeStamp);
  136.             OSErr         Create();
  137.             OSErr        Submit();
  138.         
  139.             void        DeliveryDone();
  140.             
  141.             OSErr        PutRecipient(CDSSpec& recipient,MailAttributeID recipientKind);
  142.             OSErr        PutRecipient(StringPtr addr,MailAttributeID recipientKind);
  143.             
  144.             OSErr        WriteLetterHeader();    
  145.             OSErr         WriteLetterHeader(StringPtr    theFromRecip);
  146.             OSErr        WriteHeaderSubject();
  147.             OSErr        WriteHeaderMailIndications();
  148.             OSErr        WriteHeaderSendTime();
  149.  
  150.  
  151.             //    Letter Content
  152.         OSErr            WriteBody();
  153.         
  154.         OSErr            WriteTextContent(void* textBuf,long lengthOfText);
  155.         OSErr             WriteStyleTextContent(void* textBuf,long lengthOfText, StScrpRec     *styleRec, Boolean  appendText);
  156.         
  157.         OSErr            WriteEnclosure(FSSpec*    enclosureFSSpec);
  158.  
  159.  
  160. private:
  161.     TIncomingXLetter*        fIncomingXLetter;
  162. };
  163.  
  164.  
  165.  
  166.  
  167. //--------------------------------------
  168. //        T O u t g o i n g A L e t t e r
  169. //--------------------------------------
  170.  
  171.  
  172. class TOutgoingALetter : public TALetter {
  173. public:
  174.         friend            class CContentReader;
  175.  
  176.                     TOutgoingALetter();
  177.                     ~TOutgoingALetter();
  178.         void        IOutgoingALetter(TMSAMSlot* slot, MSAMEnumerateOutQReply* outQEnumReply);
  179.         void        IOutgoingALetter(TMSAMSlot* slot, long letterSeqNo);
  180.         
  181.         MailMsgRef     GetNestedContentMsgRef();
  182.         
  183.         Boolean HasText()         { return fHasText; }
  184.         Boolean HasStyledText()    { return fHasStyledText; }
  185.         Boolean HasSound()         { return fHasSound; }
  186.         Boolean HasMovie()         { return fHasMovie; }
  187.         Boolean HasPict()         { return fHasPict; }
  188.         Boolean HasContent()     { return fHasText | fHasSound | fHasMovie | fHasPict; }
  189.         
  190.         long TextLength()         { return fTextLength; }
  191.         long StyledTextLength()    { return fStyledTextLength; }
  192.         long SoundLength()        { return fSoundLength; }
  193.         long MovieLength()        { return fMovieLength; }
  194.         long PictLength()        { return fPictLength; }
  195.         long ContentLength()     { return fTextLength+fSoundLength+fMovieLength+fPictLength; }
  196.         
  197.         
  198.     //    The following methods are candidates to promote up to TALetter
  199.     //    but today 9/2/94 only these are operations done only on outgoing letters.
  200.     
  201.         OSErr             Open();
  202.         void            OpenForSending();
  203.         
  204.  
  205.         OSErr             Close();
  206.         void            CloseSending(OSErr osErr = noErr);
  207.                 
  208.         
  209.         OSErr            SetStatus(PMSAMStatus newStatus);
  210.         OSErr            ReadLetterAttributes();
  211.         OSErr            InventoryLetterContents();
  212.         
  213.         Boolean            NeedsDeliveryReport() { return ((long)*(long*)&fIndications & kMailReceiptReportsMask ) || ((long)*(long*)&fIndications & kMailNonReceiptReportsMask);  };
  214.         void            DeliveryReport(OSErr deliverErr=0);
  215.         
  216.         void             MarkRejectedRecipient(StringPtr recipient);
  217.         void            MarkResolvedRecipients();
  218.         OSErr            MarkRecipient(short recipIndex);
  219.  
  220. private:
  221.  
  222.         Boolean    fHasText;
  223.         Boolean    fHasStyledText;
  224.         Boolean    fHasSound;
  225.         Boolean    fHasMovie;
  226.         Boolean    fHasPict;
  227.         
  228.         long    fTextLength;
  229.         long    fStyledTextLength;
  230.         long    fSoundLength;
  231.         long    fMovieLength;
  232.         long    fPictLength;
  233.     
  234.         long    fNTextSegments;
  235.         long    fNStyledTextSegments;
  236.         long    fNSoundSegments;
  237.         long    fNMovieSegments;
  238.         long    fNPictSegments;
  239.         
  240. };
  241.  
  242.  
  243.  
  244. //----------------------------------------------
  245. //    C N e s t e d L e t t e r I t e r a t o r
  246. //---------------------------------------------
  247.  
  248. class CNestedLetterIterator {
  249.  
  250. public:
  251.     CNestedLetterIterator(MailMsgRef parentMsgRef);
  252.     MailMsgRef        FirstNestedLetter();
  253.     Boolean            More();
  254.     MailMsgRef        NextNestedLetter();
  255. private:
  256.  
  257.     MailMsgRef        fEnvelopMsgRef;
  258.     MailMsgRef        fParentMsgRef;
  259.     MailMsgRef        fNestedMsgRef;
  260.     
  261. };
  262.  
  263.  
  264.  
  265.  
  266. #endif
  267.